home *** CD-ROM | disk | FTP | other *** search
/ Champak 140 / (Vol 140) Sep 19 2011.iso / Games / sea_of_fire.swf / scripts / frame_88 / DoAction_7.as < prev    next >
Text File  |  2011-09-19  |  4KB  |  163 lines

  1. function create_stru(stru_name, ai, b_tile)
  2. {
  3.    switch(b_tile)
  4.    {
  5.       case 3:
  6.          s_depth = 0;
  7.          break;
  8.       case 1:
  9.          s_depth = 500;
  10.          break;
  11.       case 5:
  12.          s_depth = 501;
  13.          break;
  14.       case 4:
  15.          s_depth = 1000;
  16.          break;
  17.       case 7:
  18.          s_depth = 1001;
  19.          break;
  20.       case 2:
  21.          s_depth = 1500;
  22.          break;
  23.       case 6:
  24.          s_depth = 1501;
  25.          break;
  26.       case 11:
  27.          s_depth = 1;
  28.          break;
  29.       case 9:
  30.          s_depth = 502;
  31.          break;
  32.       case 13:
  33.          s_depth = 503;
  34.          break;
  35.       case 10:
  36.          s_depth = 1002;
  37.          break;
  38.       case 14:
  39.          s_depth = 1003;
  40.          break;
  41.       case 8:
  42.          s_depth = 1502;
  43.          break;
  44.       case 12:
  45.          s_depth = 1503;
  46.    }
  47.    duplicateMovieClip(_root[stru_name],"stru" + b_tile,16384 + s_depth);
  48.    _root["stru" + b_tile]._x = _root["tile" + b_tile]._x;
  49.    _root["stru" + b_tile]._y = _root["tile" + b_tile]._y;
  50.    _root["stru" + b_tile].name = "stru" + b_tile;
  51.    _root["stru" + b_tile].ai = ai;
  52.    _root["stru" + b_tile].active = 1;
  53.    _root["stru" + b_tile].base_tile = b_tile;
  54.    _root["tile" + b_tile]._visible = 0;
  55.    if(tile_sel == b_tile)
  56.    {
  57.       select_tile(tile_sel);
  58.    }
  59. }
  60. function create_con_site_0(stru_name, ai, b_tile, value)
  61. {
  62.    duplicateMovieClip(_root.con_site_0,"cs" + b_tile,16384 + stru_depth);
  63.    _root["cs" + b_tile]._x = _root["tile" + b_tile]._x;
  64.    _root["cs" + b_tile]._y = _root["tile" + b_tile]._y;
  65.    _root["cs" + b_tile].ai = ai;
  66.    _root["cs" + b_tile].current = stru_name;
  67.    _root["cs" + b_tile].delay = value / 5;
  68.    _root["cs" + b_tile].delay_max = value / 5;
  69.    _root["cs" + b_tile].base_tile = b_tile;
  70.    _root["cs" + b_tile].active = 1;
  71.    stru_depth++;
  72.    _root["tile" + b_tile]._visible = 0;
  73.    if(ai == 0)
  74.    {
  75.       select_tile(b_tile);
  76.    }
  77. }
  78. function create_con_site_1(stru_name, ai, b_tile, value)
  79. {
  80.    duplicateMovieClip(_root.con_site_1,"cs" + b_tile,16384 + stru_depth);
  81.    _root["cs" + b_tile]._x = _root["tile" + b_tile]._x;
  82.    _root["cs" + b_tile]._y = _root["tile" + b_tile]._y;
  83.    _root["cs" + b_tile].ai = ai;
  84.    _root["cs" + b_tile].current = stru_name;
  85.    _root["cs" + b_tile].delay = value / 5;
  86.    _root["cs" + b_tile].delay_max = value / 5;
  87.    _root["cs" + b_tile].base_tile = b_tile;
  88.    _root["cs" + b_tile].active = 1;
  89.    stru_depth++;
  90.    _root["tile" + b_tile]._visible = 0;
  91.    select_tile(b_tile);
  92. }
  93. function damage_base(val, b)
  94. {
  95.    found = 0;
  96.    if(b == 0)
  97.    {
  98.       ai_surv++;
  99.       i = 1;
  100.       while(i <= 7)
  101.       {
  102.          if(_root["stru" + i].hp > 0)
  103.          {
  104.             _root["stru" + i].damage(val,1);
  105.             found = 1;
  106.             break;
  107.          }
  108.          i++;
  109.       }
  110.    }
  111.    else
  112.    {
  113.       hu_surv++;
  114.       i = 8;
  115.       while(i <= 14)
  116.       {
  117.          if(_root["stru" + i].hp > 0)
  118.          {
  119.             _root["stru" + i].damage(val,1);
  120.             found = 1;
  121.             break;
  122.          }
  123.          i++;
  124.       }
  125.    }
  126.    if(found == 0)
  127.    {
  128.       if(b == 0)
  129.       {
  130.          end_level(0);
  131.       }
  132.       else
  133.       {
  134.          end_level(1);
  135.       }
  136.    }
  137. }
  138. function end_level(v)
  139. {
  140.    _root.AI.active = 0;
  141.    kill_all();
  142.    hide_tiles();
  143.    _root["interface"]._visible = 0;
  144.    _root.sel_instance._x = -200;
  145.    hide_all();
  146.    show_stats();
  147.    if(v == 1)
  148.    {
  149.       _root.mentat_screen["reg_" + cur_reg].ai = 0;
  150.       _root.stats_screen.proceed._visible = 1;
  151.       _root.stats_screen.result_txt.text = "VICTORY!";
  152.    }
  153.    else
  154.    {
  155.       _root.stats_screen.proceed._visible = 0;
  156.       _root.stats_screen.result_txt.text = "DEFEAT!";
  157.    }
  158.    if(skirmish == 1)
  159.    {
  160.       _root.stats_screen.proceed._visible = 0;
  161.    }
  162. }
  163.